<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<link rel="stylesheet" type="text/css" href="js/layui/css/layui.css"/>
	<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/layer/layer.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/Global.js"></script>
	<body>
		<div id="add-Stuent" style=";" >
		       <form class="layui-form" id="add-form" action="">
				     
				   
				   
		         <div class="layui-form-item center" >
		          <label class="layui-form-label" style="width: 100px" >问题名称</label>
		          <div class="layui-input-block">
		           <input type="text"  name="name" id="indexname" style="width: 240px" lay-verify="required" placeholder="问题名称" autocomplete="off" class="layui-input">
		          </div>
		         </div>
		         <div class="layui-form-item">
		          <label class="layui-form-label" style="width: 100px">选项1</label>
		          <div class="layui-input-block">
		           <input type="text" name="type" id="option1"  required style="width: 240px" lay-verify="required" placeholder="选项1" autocomplete="off" class="layui-input">
		          </div>
		         </div>
				 
				   <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">选项2</label>
				  <div class="layui-input-block">
				   <input type="text" name="type" id="option2"  required style="width: 240px" lay-verify="required" placeholder="选项2" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				 
				 
				   <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">选项3</label>
				  <div class="layui-input-block">
				   <input type="text" name="type" id="option3"  required style="width: 240px" lay-verify="required" placeholder="选项3" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				 
				   <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">选项4</label>
				  <div class="layui-input-block">
				   <input type="text" name="type" id="option4"  required style="width: 240px" lay-verify="required" placeholder="选项4" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				 
				 
				   <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">分值1</label>
				  <div class="layui-input-block">
				   <input type="number" name="type" id="score1"  required style="width: 240px" lay-verify="required" placeholder="分值1" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				 
				  <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">分值2</label>
				  <div class="layui-input-block">
				   <input type="number" name="type" id="score2"  required style="width: 240px" lay-verify="required" placeholder="分值2" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				   <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">分值3</label>
				  <div class="layui-input-block">
				   <input type="number" name="type" id="score3"  required style="width: 240px" lay-verify="required" placeholder="分值3" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				 
				 <div class="layui-form-item">
				  <label class="layui-form-label" style="width: 100px">分值4</label>
				  <div class="layui-input-block">
				   <input type="number" name="type" id="score4"  required style="width: 240px" lay-verify="required" placeholder="分值4" autocomplete="off" class="layui-input">
				  </div>
				 </div>
				 
				 
				   
                      <!-- <div class="layui-form-item">
                       <label class="layui-form-label" style="width: 100px">是否删除</label>
                       <div class="layui-input-block">
                        <input type="number" name="type" id="delflg"  required style="width: 240px" lay-verify="required" placeholder="选择" autocomplete="off" class="layui-input">
                       </div>
                      </div> -->

				 
				 
				 
				 
				 
				 
				 
	          <!--  <div class="layui-form-item">
	            <label class="layui-form-label">所属部门</label>
	           <div class="layui-input-block" style="width: 240px"">
	             <select name="city" lay-verify="required" id="testTYpe">
	               <option value="请选择"></option>
	              
	              
	             </select>
	           </div>
	           </div>
			    -->

			
			
		       <!--  <div class="layui-form-item">
		          <label class="layui-form-label" id="isDelete" style="width: 100px">是否删除 </label>
		          <div class="layui-input-block">
		           <input type="number" name="value" required style="width: 240px" lay-verify="required" placeholder="请输入配置值" autocomplete="off" id="studentDelete" class="layui-input">
		          <input type="hidden" name="id" style="width: 240px" autocomplete="off" class="layui-input"> 
		          </div>
		         </div> -->
		         <div class="layui-form-item">
		          <div class="layui-input-block">
		          <input type="button" value="保存" id="addproblem" class="layui-btn">
		        
		          </div>
		         </div> 
		       </form>  
		    </div>
	
	</body>
	
<script>//Demo
layui.use('form', function(){
  var form = layui.form;
  
  //监听提交
  form.on('submit(formDemo)', function(data){
    layer.msg(JSON.stringify(data.field));
    return true;
  });
});
</script>
<script type="text/javascript">
	$(function(){
		var newscript = document.createElement('script');
		newscript.setAttribute('type','text/javascript');
		newscript.setAttribute('src','js/Global.js');
		var head = document.getElementsByTagName('head')[0];
		head.appendChild(newscript);
		
		
		 	 var studentid=window.globalConfig.id;
			var   optionstring=""  
           
		     
		  $("#addproblem").click(function(){
			/*  if($("#indexname").val()==null||$("#option1").val()==null$("#option2").val()==null||$("#option3").val()==null||
			  $("#option4").val()||$("#score1").val()==null||$("#score2").val()==null||$("#score3").val()==null||$("#score4").val()==null
			  $("#delflg").val()==null
			  ){
				  alert("请不要留空哟")
				  return;
			  } */
			  
			  
			  
             var data={
            			 /* "clazzid":$("#studentid1").val(), */
            			  "indexname":$("#indexname").val(),
            			  "option1":$("#option1").val(),
            			  "option2":$("#option2").val(),
            			  "option3":$("#option3").val(),
						  "option4":$("#option4").val(),
						   "score1":$("#score1").val(),
						   "score2":$("#score2").val(),
						   "score3":$("#score3").val(),
						   "score4":$("#score4").val(),
						   "delflg":$("#delflg").val()
						   
            }
			
			$.ajax({
				   type:"post",
				    dateType:"json",
				   contentType: "application/json;charset=utf-8",
				   url:"http://127.0.0.1:8080//index/add",
				   data:JSON.stringify(data),
				   success:function(msg){
					   alert(msg.data)
				   },
				   error:function(){
					   alert("失败")
				   }
			})
			 
		
		  })
		    //监听指定开关
    
		
	})
	
	
</script>

</html>
